package io.adrainty.bolee.insurance.configuration;

import io.adrainty.bolee.framework.commons.properties.TaskExecutorProperties;
import io.adrainty.bolee.framework.commons.utils.ExecutorUtil;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Executor;

/**
 * @author AdRainty
 * @version V1.0.0
 * @since 2025/8/23 下午5:05
 */

@Configuration
@EnableConfigurationProperties({
        TaskExecutorProperties.class
})
public class ThreadPoolConfig {

    @Bean("searchRecordExecutor")
    public Executor searchRecordExecutor(TaskExecutorProperties properties) {
        properties.setThreadNamePrefix("searchRecord-");
        return ExecutorUtil.createExecutor(properties);
    }

}
